$(function(){
	//初次加载展示第一个tab页(集团员工)
	ownEmployee();
	$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
		// console.log(e.target.nodeName);//获取事件触发元素标签名（li，p，div，img，button…）
		// console.log(e.target.id);//获取事件触发元素id
		// console.log(e.target.className);//获取事件触发元素classname
		// console.log(e.target.innerHTML);//获取事件触发元素的内容（li）
		// console.log(e.relatedTarget) // 老选项卡对象
		// console.log("新选项卡显示之后");

		//渲染相应的页面
		if(e.target.innerHTML == "自有员工"){
			currentPage=1;
			ownEmployee();
		}
		if(e.target.innerHTML == "委外人员"){
			currentPage=2;
			epibolyEmployee();
		}
		if(e.target.innerHTML == "资产委外"){
			currentPage=3;
			assetEpiboly();
		}
		if(e.target.innerHTML == "资产商铺"){
			currentPage=4;
			assetShops();
		}
	});

});

function ownEmployee(){
	document.getElementById("loadDiv").style.display = 'block';
	var conditionDateStr = conditionDate.format("yyyy-MM-dd");

	fetchSummary(1,conditionDateStr);//加载头部数据
	fetchSummaryFever(1,conditionDateStr);//加载尾部数据

	//地图
	drawMap(1,"mapOwn",conditionDateStr);

	drawPies(1,conditionDateStr);//绘制饼图

	fetchbg(1,conditionDateStr);//表格报告

	fetchOutReturnWork(1);//返沪返岗

	fetchWorkTrend(1);//返岗趋势

	fetchYqqs(1); //疫情趋势

	fetchyqfk(conditionDateStr);//员工队伍疫情防控工作


	setTimeout(() => {
		document.getElementById("loadDiv").style.display = 'none';
		document.getElementById("metroBody").classList.remove("metro_body_hidden")
		document.getElementById("metroBody").classList.add("metro_body_auto")
	}, 500)

}

function epibolyEmployee(){
	document.getElementById("loadDiv").style.display = 'block';
	// document.body.style.overflowY = 'hidden'

	var conditionDateStr = conditionDate.format("yyyy-MM-dd");

	fetchSummary(2,conditionDateStr);//加载头部数据
	fetchSummaryFever(2,conditionDateStr);//加载尾部数据

	//地图
	drawMap(2,"mapEpiboly",conditionDateStr);

	drawPies(2,conditionDateStr);//绘制饼图

	fetchbg(2,conditionDateStr);//表格报告


	fetchOutReturnWork(2);//运营公司返岗


	fetchWorkTrend(2);//返岗趋势

	fetchYqqs(2); //疫情趋势

	setTimeout(() => {
		document.getElementById("loadDiv").style.display = 'none';
		document.getElementById("metroBody").classList.remove("metro_body_hidden")
		document.getElementById("metroBody").classList.add("metro_body_auto")
	}, 500)

}

function assetEpiboly(){
	document.getElementById("loadDiv").style.display = 'block';
	// document.body.style.overflowY = 'hidden'
	var conditionDateStr = conditionDate.format("yyyy-MM-dd");

	fetchSummary(3,conditionDateStr);//加载头部数据
	fetchSummaryFever(3,conditionDateStr);//加载尾部数据

	//地图
	drawMap(3,"mapAsset",conditionDateStr);

	drawPies(3,conditionDateStr);//绘制饼图

	fetchbg(3,conditionDateStr);//表格报告


	fetchOutReturnWork(3);//运营公司返岗


	fetchWorkTrend(3);//返岗趋势

	setTimeout(() => {
		document.getElementById("loadDiv").style.display = 'none';
		document.getElementById("metroBody").classList.remove("metro_body_hidden")
		document.getElementById("metroBody").classList.add("metro_body_auto")
	}, 500)
//	fetchYqqs(3); //疫情趋势
}

function assetShops(){
	document.getElementById("loadDiv").style.display = 'block';
	// document.body.style.overflowY = 'hidden'
	var conditionDateStr = conditionDate.format("yyyy-MM-dd");

	//地图
	drawMap(4,"mapShops",conditionDateStr);

	drawPies(4,conditionDateStr);//绘制饼图

	setTimeout(() => {
		document.getElementById("loadDiv").style.display = 'none';
		document.getElementById("metroBody").classList.remove("metro_body_hidden")
		document.getElementById("metroBody").classList.add("metro_body_auto")
	}, 500)
}

//加载返沪返岗汇总信息
function fetchSummary(type,conditionDate) {
	var data = {type:type, conditionDate : conditionDate}
	$.ajax({
		url : "search/fetchSummary",
		dataType : "json",
		data : data,
		success : function(data) {
			if(type==1){
				$("#amountOfNonlocal").html(data[0].amountOfNonlocal);
				$("#totalAmountOfWork").html(data[0].totalAmountOfWork);
				$("#totalAmountOfReturn").html(data[0].totalAmountOfReturn);
			}else if(type==2){
				$("#amountOfNonlocalEpiboly").html(data[0].amountOfNonlocal);
				$("#totalAmountOfWorkEpiboly").html(data[0].totalAmountOfWork);
				$("#totalAmountOfReturEpiboly").html(data[0].totalAmountOfReturn);
			}else if(type==3){
				$("#amountOfNonlocalAsset").html(data[0].amountOfNonlocal);
				$("#totalAmountOfWorkAsset").html(data[0].totalAmountOfWork);
				$("#totalAmountOfReturAsset").html(data[0].totalAmountOfReturn);
			}

		}
	});
}

//加载发热疑似汇总信息
function fetchSummaryFever(type,conditionDate) {
	var data = {type:type, conditionDate : conditionDate}
	$.ajax({
		url : "search/fetchSummaryFever",
		dataType : "json",
		data : data,
		success : function(data) {
			if(type==1){
				$("#totalAmountFOfever").html(data[0].totalAmountFOfever);
				$("#totalAmountOfSeemingly").html(data[0].totalAmountOfSeemingly);
				$("#totalAmountOfConfirmed").html(data[0].totalAmountOfConfirmed);
				$("#totalAmountOfCured").html(data[0].totalAmountOfCured);
			}else if(type==2){
				$("#totalAmountFOfeverEpiboly").html(data[0].totalAmountFOfever);
				$("#totalAmountOfSeeminglyEpiboly").html(data[0].totalAmountOfSeemingly);
				$("#totalAmountOfConfirmedEpiboly").html(data[0].totalAmountOfConfirmed);
				$("#totalAmountOfCuredEpiboly").html(data[0].totalAmountOfCured);
			}else if(type==2){
				$("#totalAmountFOfeverAsset").html(data[0].totalAmountFOfever);
				$("#totalAmountOfSeeminglyAsset").html(data[0].totalAmountOfSeemingly);
				$("#totalAmountOfConfirmedAsset").html(data[0].totalAmountOfConfirmed);
				$("#totalAmountOfCuredAsset").html(data[0].totalAmountOfCured);
			}

		}
	});
}

function drawMap(type,divId,conditionDate){

	var data = {type:type, conditionDate : conditionDate}
	var mapData = [];
	var shopReturnWork = 0;
	var shopOutReturnWork = 0;
	$.ajax({
		url : "search/mapdata",
		dataType : "json",
		data:data,
		success : function(data) {
			for(var i in data){
				if(data[i].area=='湖北'){
					mapData.push({name: '湖北',value: [111.5,31,data[i].numberOfPeople]});
					shopReturnWork+=data[i].numberOfPeople;
					shopOutReturnWork+=data[i].numberOfPeople;
				}
				if(data[i].area=='上海'){
					mapData.push({name: '上海',value: [121.5,31,data[i].numberOfPeople]});
					shopReturnWork+=data[i].numberOfPeople;
				}
				if(data[i].area=='境外'){
					mapData.push({name: '境外',value: [102,51,data[i].numberOfPeople]});
					shopReturnWork+=data[i].numberOfPeople;
					shopOutReturnWork+=data[i].numberOfPeople;
				}
				if(data[i].area=='其他'){
					mapData.push({name: '其他',value: [94,36,data[i].numberOfPeople]});
					shopReturnWork+=data[i].numberOfPeople;
					shopOutReturnWork+=data[i].numberOfPeople;
				}
			}

			$("#shopReturnWork").html(shopReturnWork);
			$("#shopOutReturnWork").html(shopOutReturnWork);
			var mycharts = echarts.init(document.getElementById(divId));
			var mapOption = {
				geo: {
					map: 'china',
				},
				title : {
					text: '',
// 			        top :'5%',
					textStyle:{//标题内容的样式
						fontStyle:'normal',//主标题文字字体风格，默认normal，有italic(斜体),oblique(斜体)
						fontWeight:"bold",//可选normal(正常)，bold(加粗)，bolder(加粗)，lighter(变细)，100|200|300|400|500...
						fontFamily:"san-serif",//主题文字字体，默认微软雅黑
						fontSize:28//主题文字字体大小，默认为18px
					},
					textAlign:'left',//标题文本水平对齐方式，
				},

// 			    tooltip : {
// 			        trigger: 'item',
// 			        position: ['50%', '50%']
// 			    },
				visualMap: {
					min: 0,
					max: 30000,
					left: 'left',
					top: 'bottom',
					text:['高','低'],           // 文本，默认为数值文本
					calculable : true
				},
				series : [
					{
						name: '员工分布',
						type: 'map',
						mapType: 'china',
						roam: false
					},
					// 区域散点图
					{
						type: 'effectScatter',
						coordinateSystem: 'geo',
						label: {
							normal: {
								show: true,
								position: 'bottom',
								formatter:function(param){

									return param.name+"\n"+param.value[2];
								},
								textStyle :{
									fontSize:12,
									fontWeight:"bold",
									color :'#2E4453'
								}
							}
						},
						symbol:"circle",
						data: mapData
					}
				]
			};
			mycharts.setOption(mapOption);
		}

	});
}

function drawPies(type,conditionDate){
	var data = {type:type, conditionDate : conditionDate}

	var colorList1 = ['#3bafff','#3feed4','#00d488','#afa3f5'];
	var colorList2 = ['#f1bb4c','#43E5FF','#FF5E5E','#FFE82A'];
	var colorList3 = ['#8558f0', 'd16200','#3bafff','#3feed4'];
	var data1 = [];
	var data2 = [];
	var data3 = [];
	$.ajax({
		url : "./search/fetchStatisticswc",
		dataType : "json",
		data :data,
		async:false,
		success : function(data) {
			var val1 = {value:data[0].amountOfHubei,name:'湖北省'};
			var val2 = {value:data[0].amountOfAbroad,name:'出境'};
			var val3 = {value:data[0].amountOfExceed,name:'病例超200人省份'};
			var val4 = {value:data[0].amountOfOther,name:'其他省份'};
			data1.push(val1);
			data1.push(val3);
			data1.push(val4);
			data1.push(val2);

		}
	});
	$.ajax({
		url : "./search/fetchStatisticshh",
		dataType : "json",
		async:false,
		data :data,
		success : function(data) {
			var val1 = {value:data[0].totalAmountOfHubeiReturn,name:'湖北省'};
			var val2 = {value:data[0].totalAmountOfAbroadReturn,name:'出境'};
			var val3 = {value:data[0].totalAmountOfExceedReturn,name:'病例超200人省份'};
			var val4 = {value:data[0].totalAmountOfOtherReturn,name:'其他省份'};
			data2.push(val1);
			data2.push(val2);
			data2.push(val3);
			data2.push(val4);
		}
	});
	$.ajax({
		url : "./search/fetchStatisticsfg",
		dataType : "json",
		async:false,
		data :data,
		success : function(data) {
			var val1 = {value:data[0].totalAmountOfHubeiWork,name:'湖北省'};
			var val2 = {value:data[0].totalAmountOfAbroadWork,name:'出境'};
			var val3 = {value:data[0].totalAmountOfExceedWork,name:'病例超200人省份'};
			var val4 = {value:data[0].totalAmountOfOtherWork,name:'其他省份'};
			data3.push(val1);
			data3.push(val2);
			data3.push(val3);
			data3.push(val4);
		}
	});

	var pieChart1;
	var pieChart2;
	var pieChart3;
	if(type==1){
		pieChart1 = echarts.init(document.getElementById('pieOne'));
		pieChart2 = echarts.init(document.getElementById('pieTwo'));
		pieChart3 = echarts.init(document.getElementById('pieThree'));
	}else if(type==2){
		pieChart1 = echarts.init(document.getElementById('pieOneEpiboly'));
		pieChart2 = echarts.init(document.getElementById('pieTwoEpiboly'));
		pieChart3 = echarts.init(document.getElementById('pieThreeEpiboly'));
	}else if(type==3){
		pieChart1 = echarts.init(document.getElementById('pieOneAsset'));
		pieChart2 = echarts.init(document.getElementById('pieTwoAsset'));
		pieChart3 = echarts.init(document.getElementById('pieThreeAsset'));
	}else if(type==4){
		pieChart1 = echarts.init(document.getElementById('pieShops'));
	}

	option1 = {
		legend: {
			show:false,
			orient: 'vertical',
			top: "middle",
			right: "5%",
			textStyle: {
				color: '#f2f2f2',
				fontSize: 25,

			},
			icon: 'roundRect'
		},
		series: [
			// 主要展示层的
			{
				radius: ['45%', '70%'],
				center: ['50%', '55%'],
				type: 'pie',
				itemStyle: {
					normal: {
						color: function(params) {
							return colorList1[params.dataIndex]
						}
					}
				},
				labelLine: {
					normal: {
						show: true,
						length: 15,
						length2: 15,
						lineStyle: {
							color: '#d3d3d3'
						},
						align: 'right'
					},
					color: "#000",
					emphasis: {
						show: true
					}
				},
				label:{
					normal:{
						formatter: function(params){
							return '{a|}{nameStyle|'+params.name+' \n   '+params.value+'人}\n   '+'{rate|'+params.percent.toFixed(2)+'%}';
						},

						rich: {
							nameStyle: {
								fontSize: 9,
								color: "#555",
								align: 'left'
							},
							rate: {
								fontSize: 13,
								color: "#1ab4b8",
								align: 'left'
							}
						}
					}
				},
				data: data1
			},
			// 边框的设置
			{
				radius: ['64%', '70%'],
				center: ['50%', '55%'],
				type: 'pie',
				label: {
					normal: {
						show: false
					},
					emphasis: {
						show: false
					}
				},
				labelLine: {
					normal: {
						show: false
					},
					emphasis: {
						show: false
					}
				},
				animation: false,
				tooltip: {
					show: false
				},
				itemStyle: {
					normal: {
						color:'rgba(250,250,250,0.5)'
					}
				},
				data: [{
					value: 1,
				}],
			}
		]
	};
	pieChart1.setOption(option1);

	if(type==4){
		return;
	}

	option2 = {
		legend: {
			show:false,
			orient: 'vertical',
			top: "middle",
			right: "5%",
			textStyle: {
				color: '#f2f2f2',
				fontSize: 25,

			},
			icon: 'roundRect'
		},
		series: [
			// 主要展示层的
			{
				radius: ['45%', '70%'],
				center: ['50%', '55%'],
				type: 'pie',
				itemStyle: {
					normal: {
						color: function(params) {
							return colorList2[params.dataIndex]
						}
					}
				},
				labelLine: {
					normal: {
						show: true,
						length: 15,
						length2: 15,
						lineStyle: {
							color: '#d3d3d3'
						},
						align: 'right'
					},
					color: "#000",
					emphasis: {
						show: true
					}
				},
				label:{
					normal:{
						formatter: function(params){
							return '{a|}{nameStyle|'+params.name+' \n   '+params.value+'人}\n   '+'{rate|'+params.percent.toFixed(2)+'%}';
						},

						rich: {
							nameStyle: {
								fontSize: 9,
								color: "#555",
								align: 'left'
							},
							rate: {
								fontSize: 13,
								color: "#1ab4b8",
								align: 'left'
							}
						}
					}
				},
				data: data2
			},
			// 边框的设置
			{
				radius: ['64%', '70%'],
				center: ['50%', '55%'],
				type: 'pie',
				label: {
					normal: {
						show: false
					},
					emphasis: {
						show: false
					}
				},
				labelLine: {
					normal: {
						show: false
					},
					emphasis: {
						show: false
					}
				},
				animation: false,
				tooltip: {
					show: false
				},
				itemStyle: {
					normal: {
						color:'rgba(250,250,250,0.5)'
					}
				},
				data: [{
					value: 1,
				}],
			}
		]
	};
	pieChart2.setOption(option2);

	option3 = {
		legend: {
			show:false,
			orient: 'vertical',
			top: "middle",
			right: "5%",
			textStyle: {
				color: '#f2f2f2',
				fontSize: 25,

			},
			icon: 'roundRect'
		},
		series: [
			// 主要展示层的
			{
				radius: ['45%', '70%'],
				center: ['50%', '55%'],
				type: 'pie',
				itemStyle: {
					normal: {
						color: function(params) {
							return colorList3[params.dataIndex]
						}
					}
				},
				labelLine: {
					normal: {
						show: true,
						length: 15,
						length2: 15,
						lineStyle: {
							color: '#d3d3d3'
						},
						align: 'right'
					},
					color: "#000",
					emphasis: {
						show: true
					}
				},
				label:{
					normal:{
						formatter: function(params){
							return '{a|}{nameStyle|'+params.name+' \n   '+params.value+'人}\n   '+'{rate|'+params.percent.toFixed(2)+'%}';
						},

						rich: {
							nameStyle: {
								fontSize: 9,
								color: "#555",
								align: 'left'
							},
							rate: {
								fontSize: 13,
								color: "#1ab4b8",
								align: 'left'
							}
						}
					}
				},
				data: data3
			},
			// 边框的设置
			{
				radius: ['64%', '70%'],
				center: ['50%', '55%'],
				type: 'pie',
				label: {
					normal: {
						show: false
					},
					emphasis: {
						show: false
					}
				},
				labelLine: {
					normal: {
						show: false
					},
					emphasis: {
						show: false
					}
				},
				animation: false,
				tooltip: {
					show: false
				},
				itemStyle: {
					normal: {
						color:'rgba(250,250,250,0.5)'
					}
				},
				data: [{
					value: 1,
				}],
			}
		]
	};
	pieChart3.setOption(option3);

}

function fetchbg(type,conditionDate){

	if(type==1){
		var yygsbgStr="";
		var fyygsbgStr="";
		var pxgsbgStr="";
		$.ajax({
			url : "search/fetchReport",
			dataType : "json",
			data :{type:type, conditionDate : conditionDate,isOperation:1},
			success : function(data) {
				for(var i in data){
					yygsbgStr+="<tr><td>"+data[i].companyName+"</td>";
					yygsbgStr+="<td>"+data[i].amountOfNonlocal+"</td>";
					yygsbgStr+="<td>"+data[i].totalAmountOfWork+"</td>";
					yygsbgStr+="<td>"+data[i].rateWork.toFixed(2)+"%</td>";
					yygsbgStr+="<td>"+data[i].lastReturn+"</td>";
					yygsbgStr+="<td>"+data[i].currReturn+"</td>";
					yygsbgStr+="<td>"+data[i].lastWork+"</td>";
					yygsbgStr+="<td>"+data[i].currWork+"</td></tr>";
				}
				$("#yygsbgbody").html(yygsbgStr);
			}
		});

		$.ajax({
			url : "search/fetchReport",
			dataType : "json",
			data :{type:type, conditionDate : conditionDate,isOperation:0},
			success : function(data) {
				for(var i in data){
					fyygsbgStr+="<tr><td>"+data[i].companyName+"</td>";
					fyygsbgStr+="<td>"+data[i].amountOfNonlocal+"</td>";
					fyygsbgStr+="<td>"+data[i].totalAmountOfWork+"</td>";
					fyygsbgStr+="<td>"+data[i].rateWork.toFixed(2)+"%</td>";
					fyygsbgStr+="<td>"+data[i].lastReturn+"</td>";
					fyygsbgStr+="<td>"+data[i].currReturn+"</td>";
					fyygsbgStr+="<td>"+data[i].lastWork+"</td>";
					fyygsbgStr+="<td>"+data[i].currWork+"</td></tr>";
				}
				$("#fyygsbgbody").html(fyygsbgStr);
			}
		});
		
		$.ajax({
			url : "search/getPxInfo",
			dataType : "json",
			data :{conditionDate : conditionDate},
			success : function(data) {
				for(var i in data){
					pxgsbgStr+="<tr><td>"+data[i].client+"</td>";
					pxgsbgStr+="<td>"+data[i].trainPro+"</td>";
					pxgsbgStr+="<td>"+data[i].startDate+"</td>";
					pxgsbgStr+="<td>"+data[i].endDate+"</td>";
					pxgsbgStr+="<td>"+data[i].todayNum+"</td>";
					pxgsbgStr+="<td>"+data[i].incNum+"</td>";
					pxgsbgStr+="<td>"+data[i].decNum+"</td></tr>";
				}
				$("#pxbgbody").html(pxgsbgStr);
			}
		});
		
	}else if(type==2){
		var weiwaiReportStr="";
		$.ajax({
			url : "search/fetchReport",
			dataType : "json",
			data :{type:type, conditionDate : conditionDate,isOperation:2},
			success : function(data) {
				for(var i in data){
					weiwaiReportStr+="<tr><td>"+data[i].companyName+"</td>";
					weiwaiReportStr+="<td>"+data[i].amountOfNonlocal+"</td>";
					weiwaiReportStr+="<td>"+data[i].totalAmountOfWork+"</td>";
					weiwaiReportStr+="<td>"+data[i].rateWork.toFixed(2)+"%</td>";
					weiwaiReportStr+="<td>"+data[i].lastReturn+"</td>";
					weiwaiReportStr+="<td>"+data[i].currReturn+"</td>";
					weiwaiReportStr+="<td>"+data[i].lastWork+"</td>";
					weiwaiReportStr+="<td>"+data[i].currWork+"</td></tr>";
				}
				$("#weiwaiReportBody").html(weiwaiReportStr);
			}
		});
	}else if(type==3){
		var assetReportStr="";
		$.ajax({
			url : "search/fetchReport",
			dataType : "json",
			data :{type:type, conditionDate : conditionDate,isOperation:3},
			success : function(data) {
				for(var i in data){
					assetReportStr+="<tr><td>"+data[i].companyName+"</td>";
					assetReportStr+="<td>"+data[i].amountOfNonlocal+"</td>";
					assetReportStr+="<td>"+data[i].totalAmountOfWork+"</td>";
					assetReportStr+="<td>"+data[i].rateWork.toFixed(2)+"%</td>";
					assetReportStr+="<td>"+data[i].lastReturn+"</td>";
					assetReportStr+="<td>"+data[i].currReturn+"</td>";
					assetReportStr+="<td>"+data[i].lastWork+"</td>";
					assetReportStr+="<td>"+data[i].currWork+"</td></tr>";
				}
				$("#assetReportBody").html(assetReportStr);
			}
		});
	}



}

function fetchOutReturnWork(type){


	if(type==1){
		drawReturnWork(type,1,"mains_one");
		drawReturnWork(type,0,"mains_two");
	}else if(type==2){
		drawReturnWork(type,2,"returnWorkWeiwai");
	}else if(type==3){
		drawReturnWork(type,3,"returnWorkAsset");
	}

}

function drawReturnWork(type,isOperation,divId){
	var datax1 = [];
	var datay11 = [];
	var datay12 = [];
	var datay13 = [];
	$.ajax({
		url : "./search/fetchOutReturnWork",
		dataType : "json",
		async:false,
		data:{type:type,isOperation:isOperation},
		success : function(data) {
			for(var i=0;i<data.length;i++){
				datax1.push(data[i].statisticDate);
				datay11.push(data[i].amountOfNonlocal);
				datay12.push(data[i].totalAmountOfWork);
				datay13.push((data[i].totalAmountOfWork/data[i].amountOfNonlocal*100).toFixed(2));
			}
			var myChart = echarts.init(document.getElementById(divId));
			// option
			var option = {
				title: {
					x: 'center',
					y: 0,
					textStyle:{
						color:'#B4B4B4',
						fontSize:13,
						fontWeight:'normal',
					},

				},
				tooltip: {
					trigger: 'axis',
				},
				legend: {
					data: ['外出总人数', '返岗总人数','返岗率'],
					textStyle: {
						color: '#B4B4B4'
					},
					top:'7%',
				},
				grid:{
					left: '12%',
					right: '12%',
					bottom:'22%'
				},
				xAxis: {
					data: datax1,
					axisLine: {
						lineStyle: {
							color: '#B4B4B4'
						}
					},
					axisLabel:{
						rotate : 45
					},
					axisTick:{
						show:false,
					},
				},
				yAxis: [{
					splitLine: {show: false},
					axisLine: {
						lineStyle: {
							color: '#B4B4B4',
						}
					},
					axisLabel:{
						formatter:'{value}',
					}
				},
					{
						splitLine: {show: false},
						min: 0,
//		            max: 100,
						axisLine: {
							lineStyle: {
								color: '#B4B4B4',
							}
						},
						axisLabel:{
							formatter:'{value}%',
						},
//			        min : function(value){
//    		        	return (value.min-2).toFixed(0);
//    		        }
					}],
				dataZoom: [{
					show: true,
					height: 20,
					startValue: datax1.length-10,
					handleStyle:{
						color:"#d3dee5",

					},
					textStyle:{
						color:"#fff"
					},
					borderColor:"#90979c"

				}, {
					type: "inside",
					show: true,
					height: 15,
					start: 1,
					end: 35
				}],
				series: [
					{
						name: '外出总人数',
						type: 'bar',
						barWidth: 10,
						itemStyle: {
							normal: {
								barBorderRadius: 5,
								color: new echarts.graphic.LinearGradient(
									0, 0, 0, 1,
									[
										{offset: 0, color: '#CCE6F5'},
										{offset: 1, color: '#E3F1E4'}
									]
								)
							}
						},
						data: datay11
					},

					{
						name: '返岗总人数',
						type: 'bar',
						barGap: '-100%',
						barWidth: 10,
						itemStyle: {
							normal: {
								barBorderRadius: 5,
								color: new echarts.graphic.LinearGradient(
									0, 0, 0, 1,
									[
										{offset: 0, color: '#4DA2DA'},
										{offset: 1, color: '#00D488'}
									]
								)

							}
						},

						data: datay12
					},
					{
						name: '返岗率',
						type: 'line',
						smooth: true,
						showAllSymbol: true,
						symbol: 'emptyCircle',
						symbolSize: 8,
						yAxisIndex: 1,
						itemStyle: {
							normal: {
								color:'#FF5E5E',
//			                	label: {
//			                        show: true,
//			                        position: "top",
//			                        formatter: function(params){
//			                            return params.value+'%';
//			                        }
//			                    }
							},
						},
						data: datay13
					}
				]
			};
			myChart.setOption(option);

		}
	});
}

function fetchWorkTrend(type){
	if(type==1){
		drawWorkTrend(type,1,"main_four");
		drawWorkTrend(type,0,"main_five");
	}else if(type==2){
		drawWorkTrend(type,2,"trendWeiwai");
	}else if(type==3){
		drawWorkTrend(type,3,"trendAsset");
	}


}

function drawWorkTrend(type,isOperation,divId){
	var datax1 = [];
	var datay11 = [];
	var datay12 = [];
	var datay13 = [];
	$.ajax({
		url : "search/fetchWorkTrend",
		dataType : "json",
		async:false,
		data:{type:type,isOperation:isOperation},
		success : function(data) {
			for(var i=0;i<data.length;i++){
				datax1.push(data[i].statisticDate);
				datay11.push(data[i].actualarrival);
				datay12.push(data[i].expectedarrival);
				datay13.push(data[i].totalPeople);
			}
			var myChart = echarts.init(document.getElementById(divId));

			var option = {
				tooltip: {
					trigger: 'axis'
				},
				legend: {
					data: ['员工总人数', '当前可返岗人数','预计返岗人数'],
					left: 'center',
					top: 'top'
				},
				grid: {
					top: '15%',
					left: '15%',
					right: '5%',
					bottom:'22%'
				},
				xAxis: {
					type: 'category',
					data: datax1,
					axisLabel:{
						rotate : 45
					},
				},
				yAxis: {
					type: 'value',
					minInterval: 1,
					min : function(value){
						return value.min-5;
					},
					splitLine: {
						lineStyle: {
							type: 'dashed',
							color: '#DDD'
						}
					},
					axisLine: {
						show: false,
						lineStyle: {
							color: "#333"
						},
					},
					nameTextStyle: {
						color: "#999"
					},
					splitArea: {
						show: false
					}
				},
				dataZoom: [{
					show: true,
					height: 20,
					startValue: datax1.length-10,
					handleStyle:{
						color:"#d3dee5",

					},
					textStyle:{
						color:"#fff"
					},
					borderColor:"#90979c"

				}, {
					type: "inside",
					show: true,
					height: 15,
					start: 1,
					end: 35
				}],
				series: [{
					name: '员工总人数',
					type: 'line',
					data: datay13,
					lineStyle: {
						normal: {
							width: 3,
							color: {
								type: 'linear',
								colorStops: [{
									offset: 0,
									color: '#FFE4C2' // 0% 处的颜色
								}, {
									offset: 1,
									color: '#DCAE73' // 100% 处的颜色
								}],
								globalCoord: false // 缺省为 false
							},
						}
					},
					itemStyle: {
						normal: {
							color: '#DCAE73',
							borderWidth: 5,
							borderColor: "#DCAE73"
						}
					},
					smooth: true
				},
					{
						name: '当前可返岗人数',
						type: 'line',
						data: datay11,
						lineStyle: {
							normal: {
								width: 3,
								color: {
									type: 'linear',
									colorStops: [{
										offset: 0,
										color: '#B3DDEE' // 0% 处的颜色
									},
										{
											offset: 1,
											color: '#69C5E9' // 100% 处的颜色
										}
									],
									globalCoord: false // 缺省为 false
								},
							}
						},
						itemStyle: {
							normal: {
								color: '#69C5E9',
								borderWidth: 5,
								borderColor: "#69C5E9"
							}
						},
						smooth: true
					},
					{
						name: '预计返岗人数',
						type: 'line',
						data: datay12,
						color: "#F58080",
						lineStyle: {
							normal: {
								width: 3,
								color: {
									type: 'linear',

									colorStops: [{
										offset: 0,
										color: '#FFC9EB' // 0% 处的颜色
									},{
										offset: 1,
										color: '#F095CE' // 100% 处的颜色
									}],
									globalCoord: false // 缺省为 false
								},
							}
						},
						itemStyle: {
							normal: {
								color: '#F095CE',
								borderWidth: 5,
								borderColor: "#F095CE"
							}
						},
						smooth: true
					},
				]
			};
			myChart.setOption(option);
		}
	});
}

function fetchYqqs(type){
	var divId = "";
	if(type==1){
		divId = "main_six";
	}else if(type==2){
		divId = "fyqsWeiwai";
	}else if(type==3){
		divId = "fyqsAsset";
	}

	var datax = [];
	var datay1 = [];
	var datay2 = [];
	var datay3 = [];
	var datay4 = [];
	$.ajax({
		url : "search/fetchYqqs",
		dataType : "json",
		async:false,
		data:{type:type},
		success : function(data) {
			for(var i=0;i<data.length;i++){
				datax.push(data[i].statisticDate);
				datay1.push(data[i].totalAmountFOfever);
				datay2.push(data[i].totalAmountOfSeemingly);
				datay3.push(data[i].totalAmountOfConfirmed);
				datay4.push(data[i].totalAmountOfCured);
			}
			var myChart = echarts.init(document.getElementById(divId));
			var option = {
				tooltip: {
					trigger: 'axis'
				},
				legend: [
					{
						x:'center',
						data: ['累计发热人数','累计疑似病例人数']
					},
					{
						x:'center',
						top:'8%',
						data: ['累计确诊人数','累计治愈人数']
					}
				],
				grid: {
					top: '15%',
					left: '12%',
					right: '5%',
					bottom:'22%'
				},
				xAxis: {
					type: 'category',
					data: datax,
					axisLabel:{
						rotate : 45
					},
				},
				yAxis: {
					type: 'value',
					minInterval: 1,
					splitLine: {
						lineStyle: {
							type: 'dashed',
							color: '#DDD'
						}
					},
					axisLine: {
						show: false,
						lineStyle: {
							color: "#333"
						},
					},
					nameTextStyle: {
						color: "#999"
					},
					splitArea: {
						show: false
					}
				},
				dataZoom: [{
					show: true,
					height: 20,
					startValue: datax.length-10,
					handleStyle:{
						color:"#d3dee5",

					},
					textStyle:{
						color:"#fff"
					},
					borderColor:"#90979c"

				}, {
					type: "inside",
					show: true,
					height: 15,
					start: 1,
					end: 35
				}],
				series: [{
					name: '累计发热人数',
					type: 'line',
					smooth: true,
					data: datay1,
					color: "#F58080",
					lineStyle: {
						normal: {
							width: 3,
							color: {
								type: 'linear',

								colorStops: [{
									offset: 0,
									color: '#DDA0DD' // 0% 处的颜色
								}, {
									offset: 0.54,
									color: '#DA70D6' // 100% 处的颜色
								}, {
									offset: 1,
									color: '#BA55D3' // 100% 处的颜色
								}],
								globalCoord: false // 缺省为 false
							},
						}
					},
					itemStyle: {
						normal: {
							color: '#BA55D3',
							borderWidth: 5,
							borderColor: "#BA55D3"
						}
					},
					smooth: true
				},
					{
						name: '累计疑似病例人数',
						type: 'line',
						smooth: true,
						data: datay2,
						lineStyle: {
							normal: {
								width: 3,
								color: {
									type: 'linear',

									colorStops: [{
										offset: 0,
										color: '#FFD39B' // 0% 处的颜色
									},
										{
											offset: 0.4,
											color: '#EEC591' // 100% 处的颜色
										}, {
											offset: 1,
											color: '#CDAA7D' // 100% 处的颜色
										}
									],
									globalCoord: false // 缺省为 false
								},
							}
						},
						itemStyle: {
							normal: {
								color: '#CDAA7D',
								borderWidth: 5,
								borderColor: "#CDAA7D"
							}
						},
						smooth: true
					},
					{
						name: '累计确诊人数',
						type: 'line',
						smooth: true,
						data: datay3,
						color: "#F58080",
						lineStyle: {
							normal: {
								width: 3,
								color: {
									type: 'linear',

									colorStops: [{
										offset: 0,
										color: '#FF8247' // 0% 处的颜色
									}, {
										offset: 0.54,
										color: '#EE7942' // 100% 处的颜色
									}, {
										offset: 1,
										color: '#CD6839' // 100% 处的颜色
									}],
									globalCoord: false // 缺省为 false
								},
							}
						},
						itemStyle: {
							normal: {
								color: '#CD6839',
								borderWidth: 5,
								borderColor: "#CD6839"
							}
						},
						smooth: true
					},
					{
						name: '累计治愈人数',
						smooth: true,
						type: 'line',
						data: datay4,
						color: "#F58080",
						lineStyle: {
							normal: {
								width: 3,
								color: {
									type: 'linear',

									colorStops: [{
										offset: 0,
										color: '#C1FFC1' // 0% 处的颜色
									}, {
										offset: 0.54,
										color: '#B4EEB4' // 100% 处的颜色
									}, {
										offset: 1,
										color: '#9BCD9B' // 100% 处的颜色
									}],
									globalCoord: false // 缺省为 false
								},
							}
						},
						itemStyle: {
							normal: {
								color: '#9BCD9B',
								borderWidth: 5,
								borderColor: "#9BCD9B"
							}
						},
						smooth: true
					}
				]
			};
			myChart.setOption(option);
		}
	});
}

function fetchyqfk(conditionDate) {


	var divA = document.getElementById("modelA");//员工队伍疫情防控工作-articleType=5
	divA.innerHTML = "<P style='text-align: center'>暂无数据</P>";

	var data = {articleDate : conditionDate}
	$.ajax({
		url : "article/getArticleList",
		dataType : "json",
		data : data,
		success : function(data) {

			if (data != null && data != undefined && data.length>0)
			{
				for (var i = 0; i<data.length;i++) {
					if (data[i].articleType == 5) {
						divA.innerHTML = "";
						var index = 0;
						innerHtmlData(data[i].articleContent, divA, index);
						index++;
					}
				}
			}else
			{
				divA.innerHTML = "<P style='text-align: center'>暂无数据</P>";

			}

		}
	});

}

function innerHtmlData(articleContent,div,index) {
	if (index!=0)//第一行不需要换行
	{
		var br = document.createElement("br");
		div.appendChild(br);
	}
	var p = document.createElement("p");
	p.setAttribute("style","text-indent: 2em;line-height:20px;");
	p.innerHTML = articleContent;
	div.appendChild(p);
}

